1. Field of the Invention
The subject matter of this invention pertains to a computer system, and more particularly, to an apparatus within the computer system for automating the generation of translators and test cases needed for the verification and testing of said translators.
2. Description of the Prior Art
Compilers and interpreters are utilized by a computer system to transform a set of source code into a set of machine-readable object code. The compilers/interpreters generally comprise a data processing system and a translator program stored in said system. The data processing system under the control of the accompanying translator program receives the user's source code and transforms said code into the machine readable object code.
When the translator program is developed, it must be tested. Testing a translator program may require several man-years of testing effort.
Translator writing systems have been developed to aid in reducing the amount of time required to develop and test the translator program. These writing systems develop the translator program required by the compilers/interpreters. However, the translator writing systems of the prior art possess certain disadvantages.
Any set of translator software must utilize certain basic rules in performing a compilation function. For example, in an operation designated as "A+B*C", it must be determined whether the operation represented by "+" should be performed before or after the operation represented by "*". In making this determination, a set of rules for constructing symbol strings of a programming language should be utilized. This set of rules is known as the grammar of a language. In addition, in the above operation, a semantic analysis determines what particular actions are specified by the operations "+" and "*", that is, semantic analysis determines the meaning of the user's source code. Furthermore, the meaning of a symbol present in a user's source code is expressed by means of its attributes. Among possible attributes are source-text line numbers, type, number of dimensions, length of each dimension, internal tree structure, and storage class. For further information on these basic rules utilized by translator software in performing the compilation function, reference is directed to a book entitled "Assemblers, Compilers, and Program Translation", by Peter Calingaert, published by Computer Science Press, Inc.
Translator programs developed by the translator writing systems of the prior art did not take into account the attribute specifications required by the language of the source code being compiled and did not take into account the interaction of the attribute specifications in the grammar associated with the language of said source code. In addition, it was necessary to manually place semantic module invocations, associated with the above-mentioned semantic analysis, in the translator program developed by these translator writing systems. Manual placement of the semantic module invocations represented a major problem. The reason for the major problem is as follows: Translator writing systems act as compilers themselves, in that an original input grammar undergoes a compilation process producing a transformed grammar. Due to the manual placement of the semantic module invocations in the translator program produced by these writing systems, there was no way to relate the transformed grammar used by the system to the original input grammar. In addition, once the translator program was developed and stored in its associated data processing system environment, testing of the translator program required a tremendous amount of effort, the amount of effort required being measured in terms of man-years of testing effort.